import { Loading } from "element-ui";
let startLoading = () => {
  Loading.service({
    background: "rgb(0, 0, 0, 0.3)",
  });
};
let endLoading = () => {
  Loading.service().close();
};
let count = 0;
export let tryStartLoading = () => {
  if (count == 0) {
    startLoading();
  }
  count++;
};
export let tryHideFullScreenLoading = () => {
  if (count <= 0) return; //小于等于0 证明没有开启loading 此时return
  count--; //正常响应后 全局变量 --
  if (count === 0) {
    //等于0 时证明全部加载完毕 此时结束loading 加载
    endLoading();
  }
};
